package com.chalk.controller;


import com.chalk.common.util.Result;
import com.chalk.config.security.UserDetailsUtil;
import com.chalk.exception.ColumnNotEmptyException;
import com.chalk.model.SysUser;
import com.chalk.service.TicketOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author glq
 * @since 2020-12-24
 */

@RestController
@RequestMapping("/v1/ticketOrder")
public class TicketOrderController {
    @Autowired
    TicketOrderService ticketOrderService;

    /**
     * 票订单分页
     * @param map
     * @return
     */
    @GetMapping("getTicketOrderForPage")
    public Result getTicketOrderForPage(@RequestParam Map<String,Object> map) throws ColumnNotEmptyException {
        /* 获取操作用户 */
        SysUser sysUser = (SysUser) UserDetailsUtil.getUserInfo("sysUserService", "user_name");
        if(sysUser.getRoleId().equals("2")){
            map.put("venueId",sysUser.getVenueId().toString());
        }
        return Result.success(ticketOrderService.getTicketOrderForPage(map));
    }

}

